package config

import (
	"github.com/BurntSushi/toml"
	"log"
)

type Config struct {
	Database struct {
		Uri string
	}
	Server struct {
		Addr string
	}
	DianPing struct {
		BaseUrl     string
		UserAgent   string
		Cookie      string
		Host        string
		Sec         string
		Accept      string
		Ua          string
		AcceptAjax  string
		RequestWith string
		Tcv         string
		UUid        string
		Model       int
		City        int
	}
	Init struct {
		Successful bool
	}
	TimeOut struct {
		UrlTimeOut  int64
		PageTimeOut int64
		InfoTimeOut int64
	}
}

var Conf Config

func InitConfig() {
	if _, err := toml.DecodeFile("config.toml", &Conf); err != nil {
		panic(err)
	}
	log.Printf("配置文件加载完成 %+v", Conf)
}
